package hu.bme.mit.mdsd.csipetcsapat.appstore.core;

import java.util.List;
import java.util.ArrayList;

/*
 * Implementation of Role class
 */
public class Role {
	private String name;
	private List<String> services;
	
	/*
 	 * Default Constructor
	 */
	public Role() {
		this.name = "USER";
		this.services = new ArrayList<String>();
	}
	
	/*
 	 * Constructor
	 */
	public Role(String name) {
		this.name = name;
		this.services = new ArrayList<String>();
	}
	
	/*
 	 * Get role name
	 */
	public String getName() {
		return this.name;
	}
	
	/*
 	 * Get accessible services by this role
	 */
	public List<String> getServices() {
		return this.services;
	}
	
	/*
 	 * Set accessible services by this role
	 */
	public void setServices(List<String> services) {
		this.services = services;
	}
	
	/*
 	 * Add accessible service to the role
	 */
	public void addService(String service) {
		this.services.add(service);
	}
	
	/*
 	 * Remove accessible service to the role
	 */
	public void removeService(String service) {
		this.services.remove(service);
	}
	
	/*
 	 * Determines if the role has access to a service
	 */
	public boolean hasAccess(String service) {
		return this.services.contains(service);
	}
}
